// cnpm install express socket.io
const http = require("http");
const express = require("express");
const socketIo = require("socket.io");
const app = express();
const httpServer = http.createServer(app);
const io = socketIo(httpServer);
io.on("connection",function(socket){
    console.log("连接成功",socket.id);
    // setInterval(()=>{
    //     socket.emit("two",10,20,30,40);
    // },2000)
    socket.on("one",function(a,b,c,d){
        console.log("one",a,b,c,d);
        io.emit("two",10,20,30,40);
    })
    socket.on("disconnect",function(){
        console.log("断开连接！",socket.id);
    })
})
app.use(express.static(__dirname));
httpServer.listen(80,()=>{
    console.log("success");
})
